﻿//AcademicPlanner - course registration planning web app.
//Copyright (C) 2009  Boubacar Diallo

//This program is free software; you can redistribute it and/or
//modify it under the terms of the GNU General Public License
//as published by the Free Software Foundation; either version 2
//of the License, or (at your option) any later version.

//This program is distributed in the hope that it will be useful,
//but WITHOUT ANY WARRANTY; without even the implied warranty of
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//GNU General Public License for more details.

//You should have received a copy of the GNU General Public License
//along with this program; if not, write to the Free Software
//Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AcademicPlanner.Data
{
	/// <summary>
	/// Entity is the base class for all data entities of the
	/// AcademicPlanner application. An <c>Entity</c> represents the
	/// data aspect of a domain layer's <c>Model</c>.
	/// </summary>
	/// <since>1.0</since>
    public abstract class Entity
    {
		/// <summary>
		/// Gets the <c>DataSourceAccessSupervisor</c> of the data layer of the application.
		/// </summary>
		/// <since>1.0</since>
		protected DataSourceAccessSupervisor DSAS { get { return DataSourceAccessSupervisor.GetInstance(); } }

		/// <summary>
		/// Gets or sets this <c>Entity</c>'s id.
		/// </summary>
		/// <since>1.0</since>
		public virtual int Id { get; set; }

		/// <summary>
		/// Gets or sets this <c>Entity</c>'s date of creation.
		/// </summary>
		/// <since>1.0</since>
		public virtual DateTime Date_Added { get; set; }

		/// <summary>
		/// Gets or sets whether this <c>Entity</c> is deleted or not.
		/// </summary>
		/// <since>1.0</since>
		public virtual bool Trashed { get; set; }


		/// <summary>
		/// Sets the default values of this <c>Entity</c>'s properties.
		/// <c>Date_Added</c> is set to <c>DateTime.Now</c> and
		/// <c>Trashed</c> is set to <c>false</c>.
		/// </summary>
		/// <since>1.0</since>
		public virtual void SetDefaults()
		{
			Date_Added = DateTime.Now;
			Trashed = false;
		}

		/// <summary>
		/// Sets this Entity's <c>Trashed</c> property to <c>true</c>.
		/// </summary>
		/// <since>1.0</since>
		public virtual void Trash()
		{
			Trashed = true;
		}
    }
}
